#pragma once
#include "DXAMLCommon.h"
#include "xamlserviceprovidercontext.h"
#include "CompressedObjectWriterStack.h"
//#include "XamlProperty.h"
//#include "ObjectWriterContext.h"
class XamlServiceProviderContext;
class XamlProperty;
class ObjectWriterContext;

enum CompressedObjectWriterStack::eCompressedStackCacheHint;
class XamlType;
class XamlSchemaContext;
struct IPALUri;


class XamlCommonServiceProviderContext :
	public XamlServiceProviderContext
{
private: 
	xweak_ptr<XamlSchemaContext> m_spXamlSchemaContext;
	xweak_ptr<ObjectWriterContext> m_spObjectWriterContext;
	xshared_ptr<XamlServiceProviderContext> m_spPreviousServiceProviderContext;
	XamlCommonServiceProviderContext(xshared_ptr<ObjectWriterContext> & spObjectWriterContext);
public: 
	static HRESULT Create(xshared_ptr<ObjectWriterContext> & spObjectWriterContext, xshared_ptr<XamlCommonServiceProviderContext> & rspServiceProviderContext);
	HRESULT IXamlSchemaContextProvider_get_SchemaContext(xshared_ptr<XamlSchemaContext> & rspSchemaContext);
	HRESULT IRootObjectProvider_get_RootObject(xshared_ptr<XamlQualifiedObject> & rqoRoot);
	HRESULT IProvideFileInfo_GetFileInfo(XUINT32 *, XUINT32 *, xshared_ptr<CXString> &);
	HRESULT IXamlTypeResolver2_ResolveXamlType(struct XamlTypeToken, xshared_ptr<XamlType> & rspType);
	HRESULT IXamlTypeResolver2_ResolveXamlType(xshared_ptr<CXString> & spQName, xshared_ptr<XamlType> & rspType);
	HRESULT IUriContext_get_BaseUri(xref_ptr<IPALUri> &);
	HRESULT IAmbientPropertyProvider_GetAmbientTargetType(xshared_ptr<XamlQualifiedObject> & rqoValue);
	HRESULT IAmbientPropertyProvider_GetAmbientValue(const xshared_ptr<XamlType> &, const xshared_ptr<XamlType> &, const xshared_ptr<XamlProperty> &, const xshared_ptr<XamlProperty> &, const xshared_ptr<XamlType> &, xshared_ptr<XamlQualifiedObject> &);
	HRESULT IAmbientPropertyProvider_GetAllAmbientValues(class xshared_ptr<XamlType> spCeilingType, class xshared_ptr<XamlProperty> spProperty, class xshared_ptr<XamlType> spTypeToFind, enum CompressedObjectWriterStack::eCompressedStackCacheHint eCacheHint, xvector<xshared_ptr<XamlQualifiedObject> > & rvecValues);
	HRESULT IAmbientPropertyProvider_GetAllAmbientValues(class xshared_ptr<XamlType> spCeilingType, class xshared_ptr<XamlProperty> spProperty, class xshared_ptr<XamlType> spTypeToFind, xvector<xshared_ptr<XamlQualifiedObject> > & rvecValues);
	HRESULT IProvideValueTarget_get_TargetObject(xshared_ptr<XamlQualifiedObject> & spTargetObject);
	HRESULT IProvideValueTarget_get_TargetProperty(xshared_ptr<XamlProperty> & spPropertyInfo);
	XUINT32 HasPreviousServiceProviderContext();
	virtual ~XamlCommonServiceProviderContext();
private: 
	HRESULT GetObjectWriterContext(xshared_ptr<ObjectWriterContext> & rspObjectWriterContext);
	HRESULT GetCore(CCoreServices * * ppCore);


};


